<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/css/global.css" media="all">
    <link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/plugins/font-awesome/css/font-awesome.min.css">
    <script type="text/javascript" src="/plugins/layui/layui.js"></script>
    <title>Title</title>
</head>
<body>
<div style="margin: 15px;">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>添加简介(<label class="layui-required-tip">标红的为必填项</label>)</legend>
    </fieldset>

    <form id="layui-form" class="layui-form" action="" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label layui-required-tip">简介内容</label>
            <div class="layui-input-block">
                <textarea id="content" lay-verify="required" name="content" placeholder="简介内容" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-required-tip">类型：</label>
            <div class="layui-input-block">
                <select  id="type" name="type" class="layui-input" lay-filter="select_filter" style="padding: 0px 20px;">
                    <option value="">全部</option>
                    <option value="1">大盘</option>
                    <option value="2">权重</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="save">保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                <a href="/manage/intro/introList" class="layui-btn">返回</a>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['form','jquery'],function () {
        var form = layui.form,$ = layui.jquery;

        form.on('submit(save)',function (data) {
            $.ajax({
                type : "post",
                url : "/manage/intro/insIntro",
                dataType : "json",
                data :data.field,
                success : function(data) {
                    layer.alert(data.msg, {
                        skin: 'layui-layer-molv' //样式类名  自定义样式
                        ,closeBtn: 1    // 是否显示关闭按钮
                        ,anim: 1 //动画类型
                        ,btn: ['确定'] //按钮
                        ,icon: data.code>=0?1:2    // icon
                        ,yes:function(index){
                            if (data.code >= 0) {
                                location.href = "/manage/intro/introList";
                            }else{
                                layer.close(index);
                            }
                        }
                    });
                }
            });
            return false;
        });
    })
</script>
</body>
</html>